package WebDriver_Prac_Sel_tests_office_place;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;

import static org.hamcrest.CoreMatchers.*;
import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

public class Firefox_profile_webdriver_navigate_test1 {

// Testing13f


	/**
	 * @param args
	 * @throws InterruptedException 
	 */
	public static void main(String[] args) throws InterruptedException  {
		// TODO Auto-generated method stub
		//http://code.google.com/p/selenium/wiki/FrequentlyAskedQuestions
		// open specific profile on firefox
		// 3 reasons to specify profile...
		// a) proxy settings b)  certificate issues c)download file window popup autosave etc
		ProfilesIni allprofiles=new ProfilesIni();
		FirefoxProfile profile=allprofiles.getProfile("Default User");
		WebDriver Driver_f=new FirefoxDriver(profile);
		//WebDriver Driver_f=new FirefoxDriver();
		//Driver_f.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
		//WebDriver Driver_f=new HtmlUnitDriver();
		//Driver_f.get("http://www.wiki.com");
				
		// Driver_f.wait(5000);
		
		//WebDriver Driver_e= new InternetExplorerDriver();
		
		//Driver_e.get("http://www.wiki.com");

		//Driver_e.wait(5000);
		//System.out.println(Driver_f.getTitle());
		
		
		//Driver_f.close();
		
		//Driver_f.navigate().to("http://www.bbc.com");
		//System.out.println(Driver_f.getTitle());
		//System.out.println(Driver_f.getTitle());
		//Driver_f.close();

		Driver_f.navigate().to("http://www.gmail.com");
		System.out.println(Driver_f.getTitle());
		Driver_f.findElement(By.id("Email")).sendKeys("raghu.alapati2");
		Driver_f.findElement(By.id("Passwd")).sendKeys("satpalm11");
		Driver_f.findElement(By.id("signIn")).click();
		Driver_f.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
		//Driver_f.findElement(By.linkText("Inbox (3)")).click();
		Driver_f.findElement(By.xpath("//iframe[@id='canvas_frame']//a[@title='Inbox (2)']")).click();
		Driver_f.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
		Driver_f.findElement(By.xpath("//iframe[@id='canvas_frame']//a[@title='Buzz']")).click();
		//Driver_f.findElement(By.linkText("Inbox (3)")).
		//Driver_f.findElement(By.xpath("//div[@class='nH GcwpPb-Z8OBDd']//span[@id='gbgs4' and @class='gbta bgtsa']")).click();
		//Driver_f.findElement(By.id("gbi4m1")).click();
		Driver_f.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
		//Driver_f.findElement(By.id("gb_71")).click();
		Driver_f.findElement(By.xpath("//a[@id='gb_71' and @class='gbml1' and @href='?logout&hl=en]")).click();
		Driver_f.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
	}

}
